package com.lanca.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.websocket.server.PathParam;

@RestController
public class ProductController {

    private static final Logger log = LoggerFactory.getLogger(ProductController.class);

    @Value("${server.port}")
    private int port;

    @GetMapping("/product")
    public String getProduct() {
        log.info("进入商品服务。，，，，，。。。。");
        return "abc product result product模块提供服务端口：" + port;
    }

    @GetMapping("/test")
    public String test(String name, Integer age) {
        log.info("name:{},age:{}", name, age);
        return name + " --- " + age + " product模块提供服务端口： " + port;

    }

    @GetMapping("/test1/{id}/{name}")
    public String test1(@PathVariable("id") Integer id, @PathVariable("name") String name) {
        log.info("name:{},id:{}", name, id);
        return name + " --- " + id + " product模块提供服务端口： " + port;

    }

}
